package Main;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Vector;

public class SecondParse {
	
	private static String fixLine(String line){
		
		int index=line.indexOf('<');
		while (index>=0){
			int index2=line.indexOf('>', index);
			if (index2>0){
				line=line.substring(index)+line.substring(index2+1,line.length());
			}
			line.indexOf('<');
		}
		return line;
	}
	
	public static String htmlToText(String html){
		
//		html=html.replace("<br />", "\n");
//		html=html.replace("<br/>", "\n");
		html=html.replace("</p>", "\n");
		Vector<String> lines=String2.split(html, "<");
		String text=lines.elementAt(0);
		for(int i=1;i<lines.size();i++){
			int index=lines.get(i).indexOf('>');
			text+=lines.get(i).substring(index+1);
		}
		return text;
	}
	
//	//01<34>6
//	
//	public static String htmlToText(String html){
//		System.out.println((char)html.charAt(24));
//		System.out.println(html.indexOf('\n'));
//		Collection<String> lines=String2.split(html, "\n");
//		String text="";
//		for(String line : lines){
//			System.out.println(line);
//			System.out.println(fixLine(line));
//			text+=fixLine(line);
//			System.out.println(text);
//			System.out.println("---------------------------------------------------");
//		}
//		return text;
//	}

}
